<?php defined('SYSPATH') OR die('No direct access allowed.');

class Product_Model extends ORM 
{
	protected $has_one = array('city', 'gym');
	
	public function get_product($id)
	{
		return $this->find($id);
	}

	public function get_all_product_in_sold()
	{
		return $this->where('state', 'sold')->find_all();
	}

	public function get_city_zone($id)
	{
		return $this->get_product($id)->city->zone;
	}

	public function get_city_name($id)
	{
		return $this->get_product($id)->city->name;
	}

} // End Product Model
